■ <HTML> <!-- Copyright (c) Microsoft Corporation. All rights reserved.--> <HEAD> <TITLE>Status Page</TITLE> <SCRIPT LANGUAGE="VBScript"> <!-- Option Explicit 'Windows constants for key codes Public Const RightArrow = 39 Public Const LeftArrow = 37 Public Const EnterKey = 13 Public Const EscapeKey = 27 Public Const TabKey = 9 'special code for new alerts Public Const NewAlertKey = 135 'color constants Public Const BLACK = "#000000" Public Const WHITE = "#FFFFFF" 'Three dimentional array holding alert captions, descriptions and long descs Dim AlertsArray() 'Number of active localui alerts Dim NumberOfAlerts 'Do the alerts fit one LCD page Dim bOnlyOnePage 'Viewing the long description of the alert Dim bAlertViewMode 'Ip address of the local machine Dim strCurrentIp 'Hostname of the local machine Dim strHostName 'Index of the alert with the focus Dim intCurrentAlert 'Current alert with the focus Dim iFocusAlert 'sahelper component Dim objSaHelper 'Timer for idle timeout Dim iIdleTimeOut '---------------------------------------------------------------------------- ' Function: Window_OnLoad ' Description: Initialization routine for the page ' Input Variables: None ' Output Variables: None ' Return Values: None ' Global Variables: AlertsArray,NumberOfAlerts,bAlertViewMode,bOnlyOnePage '---------------------------------------------------------------------------- Sub Window_OnLoad() On Error Resume Next Err.Clear NumberOfAlerts = 0 bAlertViewMode = false 'Get the current local ui alerts GetLocalUIAlerts 'window.alert NumberOfAlerts 'If there are alerts If NumberOfAlerts <> 0 Then bOnlyOnePage = AlertsFitOnePage ServeLocalUIAlerts 'hide the text resource control TextResourceCtrl.style.display = "none" 'set the focus to the first alert SaAlert1.focus 'Display the localui logo Else ServerLocalUILogo() salogo.style.display = "" 'set the focus to tasks link SaTasksLink.focus End If 'Display alternating ip and hostname information ServeIpHostNameInfo 'Get the resources and resize the resource controls GetLocalUIResources On Error Resume Next Err.Clear 'set the key codes for the page Dim objKeypad Set objKeypad = CreateObject("Ldm.SAKeypadController") If Err.number = 0 Then objKeypad.Setkey 0,TabKey,TRUE objKeypad.Setkey 1,TabKey,FALSE objKeypad.Setkey 2,LeftArrow,FALSE objKeypad.Setkey 3,RightArrow,FALSE objKeypad.Setkey 4,EscapeKey,FALSE objKeypad.Setkey 5,EnterKey,FALSE Set objKeypad = Nothing End If End Sub '---------------------------------------------------------------------------- ' Function: ServerLocalUILogo ' Description: Gets the name of the logo file from elementmgr ' Input Variables: None ' Output Variables: None ' Return Values: None ' Global Variables: salogo '---------------------------------------------------------------------------- Sub ServerLocalUILogo() Dim objLogoElementCol Dim objLogoElement Dim objRetriever Dim strLogoFileName Dim iSmallestMerit Dim iCurrentMerit On Error Resume Next Err.Clear 'Merit for our localui logo iSmallestMerit = 300 strLogoFileName = "" 'Create elementmgr and get resource elements Set objRetriever = CreateObject("Elementmgr.ElementRetriever") If Err.Number = 0 Then Set objLogoElementCol = objRetriever.GetElements(1, "OemLocalUILogo") If Err.Number = 0 Then 'count the icon and text resources For Each objLogoElement in objLogoElementCol iCurrentMerit = CInt(objLogoElement.GetProperty("Merit")) If iCurrentMerit <= iSmallestMerit Then iSmallestMerit = iCurrentMerit strLogoFileName = objLogoElement.GetProperty("ElementGraphic") End If Next End If End If Err.Clear 'Set the logo file If strLogoFileName <> "" Then SaLogo.src = strLogoFileName End If Set objRetriever = Nothing Set objLogoElement = Nothing Set objLogoElementCol = Nothing End Sub '---------------------------------------------------------------------------- ' Function: ServeLocalUIAlerts ' Description: Formats and display the alerts with their descriptions ' Input Variables: None ' Output Variables: None ' Return Values: None ' Global Variables: AlertsArray,NumberOfAlerts,bOnlyOnePage,intCurrentAlert '---------------------------------------------------------------------------- Sub ServeLocalUIAlerts() 'Only one alert or one alert per page If bOnlyOnePage = false or NumberOfAlerts = 1 Then 'Display the first alert SaAlert1.innerText = AlertsArray(0,0) SaAlert1.href = "localui_alertview.htm" SaDesc1.innerText = AlertsArray(0,1) 'Display the page info, if there are more than one alert If NumberOfAlerts > 1 Then SaPageInfo.innertext = (intCurrentAlert+1)&"/"&(NumberOfAlerts) End If 'Alerts fit one page, display all of them Else 'Three alerts, since they fit one page they don't have descs If NumberOfAlerts = 3 Then SaAlert1.innerText = AlertsArray(0,0) SaAlert1.href = "localui_alertview.htm" SaAlert2.innerText = AlertsArray(1,0) SaAlert2.href = "localui_alertview.htm" SaAlert3.innerText = AlertsArray(2,0) SaAlert3.href = "localui_alertview.htm" Else 'Two alerts SaAlert1.innerText = AlertsArray(0,0) SaAlert1.href = "localui_alertview.htm" If AlertsArray(0,1) = "" Then SaAlert2.innerText = AlertsArray(1,0) SaAlert2.href = "localui_alertview.htm" SaDesc2.innerText = AlertsArray(1,1) Else SaDesc1.innerText = AlertsArray(0,1) SaAlert3.href = "localui_alertview.htm" SaAlert3.innerText = AlertsArray(1,0) End If End If 'We don't need page info,they fit one page SaPageInfo.innertext = "" End If intCurrentAlert = 0 End Sub '---------------------------------------------------------------------------- ' Function: AlertsFitOnePage ' Description: Checks if alerts fit one page ' Input Variables: None ' Output Variables: None ' Return Values: Boolean ' Global Variables: AlertsArray '---------------------------------------------------------------------------- Function AlertsFitOnePage() 'Only one alert, fits one page If NumberOfAlerts = 1 Then AlertsFitOnePage = true Else AlertsFitOnePage = false End If End Function '---------------------------------------------------------------------------- ' Function: ServeIpHostNameInfo ' Description: Obtains ip and hostname information for the local host ' Starts the timer for displaying the information ' Input Variables: None ' Output Variables: None ' Return Values: None ' Global Variables: strCurrentIp,strHostName '---------------------------------------------------------------------------- Sub ServeIpHostNameInfo() On Error Resume Next Err.Clear Dim intTimeOut Dim intIpHostNameCheckTimeOut 'Create SaHelper object Set objSaHelper = CreateObject("ServerAppliance.SAHelper") If Err.Number <> 0 Then strCurrentIp = "UNKNOWN" strHostName = "UNKNOWN" 'Get the hostname and ip address Else 'start the timeout to check ip and hostname, 3 minutes intIpHostNameCheckTimeOut = window.SetTimeOut("GetIpHostName",180000) strCurrentIp = objSaHelper.IpAddress If Err.Number <> 0 Then strCurrentIp = "UNKNOWN" End If strHostName = objSaHelper.HostName If Err.Number <> 0 Then strHostName = "UNKNOWN" End If End If 'Starting from the hostname display the information SaIpHostInfo.innerText = strHostName intTimeOut = window.SetTimeOut("FlipIpHostName(1)",5000) End Sub '---------------------------------------------------------------------------- ' Function: GetIpHostName ' Description: Obtains ip and hostname information for the local host ' Input Variables: None ' Output Variables: None ' Return Values: None ' Global Variables: strCurrentIp,strHostName '---------------------------------------------------------------------------- Sub GetIpHostName() On Error Resume Next Err.Clear Dim intIpHostNameCheckTimeOut 'start the timeout to check ip and hostname, 3 minutes intIpHostNameCheckTimeOut = window.SetTimeOut("GetIpHostName",180000) strCurrentIp = objSaHelper.IpAddress strHostName = objSaHelper.HostName End Sub '---------------------------------------------------------------------------- ' Function: FlipIpHostName ' Description: Change the value getting displayed and reset the timer ' Input Variables: iIndex, current value displayed ' 1, hostname 0, ip address ' Output Variables: None ' Return Values: None ' Global Variables: strCurrentIp,strHostName '---------------------------------------------------------------------------- Sub FlipIpHostName(iIndex) Dim intTimeOut If iIndex = 1 Then SaIpHostInfo.innertext = strCurrentIp intTimeOut = window.SetTimeOut("FlipIpHostName(0)",5000) Else intTimeOut = window.SetTimeOut("FlipIpHostName(1)",5000) SaIpHostInfo.innertext = strHostName End If End Sub '---------------------------------------------------------------------------- ' Function: GetLocalUIResources ' Description: Counts the number of text and icon resources and sets ' the size of the ActiveX control ' Input Variables: None ' Output Variables: None ' Return Values: None ' Global Variables: None '---------------------------------------------------------------------------- Sub GetLocalUIResources() Dim objResourceElementCol Dim objResourceElement Dim objRetriever Dim strTextResource 'Number of icon resources Dim NumberOfIconResources 'Number of text resources Dim NumberOfTextResources On Error Resume Next NumberOfIconResources = 0 NumberOfTextResources = 0 'Create elementmgr and get resource elements Set objRetriever = CreateObject("Elementmgr.ElementRetriever") If Err.Number = 0 Then Set objResourceElementCol = objRetriever.GetElements(1, "LocalUIResource") If Err.Number = 0 Then 'count the icon and text resources For Each objResourceElement in objResourceElementCol strTextResource = "" strTextResource = objResourceElement.GetProperty("IsTextResource") If CInt(strTextResource) = 1 Then NumberOfTextResources = NumberOfTextResources + 1 Else NumberOfIconResources = NumberOfIconResources + 1 End If Next End If End If Err.Clear 'Set the width of the icon control ResourceCtrl.style.width = NumberOfIconResources * 16 'we allow at most 3 text resources If NumberOfTextResources > 3 Then TextResourceCtrl.style.top = 0 TextResourceCtrl.style.height = 36 Else TextResourceCtrl.style.top = 36 - (12*NumberOfTextResources) TextResourceCtrl.style.height = 12*NumberOfTextResources End If Set objRetriever = Nothing Set objResourceElement = Nothing Set objResourceElementCol = Nothing End Sub '---------------------------------------------------------------------------- ' Function: GetLocalUIAlerts ' Description: Get the local ui alerts from WMI and corresponding element ' definitions from element and loc manager ' Input Variables: None ' Output Variables: None ' Return Values: None ' Global Variables: AlertsArray,NumberOfAlerts '---------------------------------------------------------------------------- Sub GetLocalUIAlerts() Dim objElement Dim objElementCol Dim objAlertElementCol Dim objAlertElement Dim objLocMgr Dim strElementID Dim strAlertLog Dim varReplacementStrings Dim objRetriever Dim intCaptionID Dim intDescriptionID Dim intLongDescriptionID Dim intCount Dim strSourceDll On Error Resume Next Err.Clear 'Create elementmgr and get current alerts Set objRetriever = CreateObject("Elementmgr.ElementRetriever") If Err.Number = 0 Then 'window.alert "Created" Set objElementCol = objRetriever.GetElements(1, "SA_Alerts") If objElementCol.Count=0 or Err.Number <> 0 Then Err.Clear NumberOfAlerts = 0 Else 'window.alert NumberOfAlerts ReDim AlertsArray(objElementCol.Count-1,2) 'get alert definitions Set objAlertElementCol = objRetriever.GetElements(1,"LocalUIAlertDefinitions") 'create localization manager to get alert strings Set objLocMgr = CreateObject("ServerAppliance.LocalizationManager") If (Err.Number <> 0) Then Err.Clear NumberOfAlerts = 0 Else intCount = 0 For Each objElement in objElementCol strAlertLog = objElement.GetProperty("AlertLog") strElementID = "LocalUIAlertDefinitions" & strAlertLog & Hex(objElement.GetProperty("AlertID")) strText = "" Err.Clear Set objAlertElement = objAlertElementCol.Item(strElementID) If Err <> 0 Then Set objAlertElement = Nothing Else strSourceDll = objAlertElement.GetProperty("Source") intCaptionID = "&H" & objAlertElement.GetProperty("CaptionRID") intDescriptionID = "&H" & objAlertElement.GetProperty("DescriptionRID") intLongDescriptionID = "&H" & objAlertElement.GetProperty("LongDescriptionRID") varReplacementStrings = objElement.GetProperty("ReplacementStrings") AlertsArray(intCount,0) = objLocMgr.GetString(strSourceDll, intCaptionID, varReplacementStrings) AlertsArray(intCount,1) = objLocMgr.GetString(strSourceDll, intDescriptionID, varReplacementStrings) AlertsArray(intCount,2) = objLocMgr.GetString(strSourceDll, intLongDescriptionID, varReplacementStrings) intCount = intCount + 1 End If Next NumberOfAlerts = intCount 'window.alert intCount End If End If End If Set objLocMgr = Nothing Set objElement = Nothing Set objElementCol = Nothing Set objAlertElement = Nothing Set objAlertElementCol = Nothing Set objRetriever = Nothing End Sub '---------------------------------------------------------------------------- ' Function: InvertSelection ' Description: Inverts the focus element's background and foreground ' Input Variables: intIndex, index of the focus element ' Output Variables: None ' Return Values: None ' Global Variables: None '---------------------------------------------------------------------------- Sub InvertSelection(intIndex) iFocusAlert = intIndex 'Invert the background and foreground for the focus element If intIndex = 0 Then SaAlert1.style.backgroundColor = BLACK SaAlert1.style.color = WHITE ElseIf intIndex = 1 Then SaAlert2.style.backgroundColor = BLACK SaAlert2.style.color = WHITE ElseIf intIndex = 2 Then SaAlert3.style.backgroundColor = BLACK SaAlert3.style.color = WHITE ElseIf intIndex = -1 Then SaTasksImage.src = "localui_sataskinverted.bmp" End If End Sub '---------------------------------------------------------------------------- ' Function: InvertToNormal ' Description: Inverts element that loses focus to normal ' Input Variables: intIndex, index of the element loosing the focus, -1 for alerts link ' Output Variables: None ' Return Values: None ' Global Variables: None '---------------------------------------------------------------------------- Sub InvertToNormal(intIndex) 'Invert the background and color for the element loosing the focus If intIndex = 0 Then SaAlert1.style.backgroundColor = "" SaAlert1.style.color = BLACK ElseIf intIndex = 1 Then SaAlert2.style.backgroundColor = "" SaAlert2.style.color = BLACK ElseIf intIndex = 2 Then SaAlert3.style.backgroundColor = "" SaAlert3.style.color = BLACK ElseIf intIndex = -1 Then 'if there are alerts,let the focus to leave If NumberOfAlerts <> 0 Then SaTasksImage.src = "localui_satask.bmp" 'cancel the event Else window.event.returnValue = false End If End If End Sub '---------------------------------------------------------------------------- ' Function: KeyDown ' Description: Changes pages in response to right and left arrows ' in multiple alert page mode ' Input Variables: None ' Output Variables: None ' Return Values: None ' Global Variables: None '---------------------------------------------------------------------------- Sub KeyDown() If window.event.keycode = NewAlertKey Then window.navigate "localui_main.htm" Exit Sub End If 'if there are alerts and they don't fit one page If NumberOfAlerts > 0 and bOnlyOnePage = false and bAlertViewMode = false Then 'right arrow If window.event.keycode = RightArrow Then intCurrentAlert = intCurrentAlert + 1 If intCurrentAlert = NumberOfAlerts Then intCurrentAlert = 0 End If window.event.cancelBubble = true End If 'left arrow If window.event.keycode = LeftArrow Then intCurrentAlert = intCurrentAlert - 1 If intCurrentAlert = -1 Then intCurrentAlert = NumberOfAlerts - 1 End If window.event.cancelBubble = true End If SaAlert1.innertext = AlertsArray(intCurrentAlert,0) SaAlert1.href = "localui_alertview.htm" SaDesc1.innertext = AlertsArray(intCurrentAlert,1) SaPageInfo.innertext = (intCurrentAlert+1)&"/"&(NumberOfAlerts) End If 'If we are in alert view mode and escape key is hit If bAlertViewMode = true Then If window.event.keycode = EscapeKey Then 'clear the timeout window.clearTimeOut(iIdleTimeOut) SaAlert1.style.display = "" SaAlert2.style.display = "" SaAlert3.style.display = "" SaDesc1.style.display = "" SaDesc2.style.display = "" SaIpHostInfo.style.display = "" SaPageInfo.style.display = "" SaTasksLink.style.display = "" ResourceCtrl.style.display = "" SaAlertView.style.display = "none" bAlertViewMode = false 'set the focus back to the selected alert If iFocusAlert = 0 Then SaAlert1.focus ElseIf iFocusAlert = 1 Then SaAlert2.focus ElseIf iFocusAlert = 2 Then SaAlert3.focus End If Else 'clear the timeout and restart it window.clearTimeOut(iIdleTimeOut) iIdleTimeOut = window.SetTimeOut("IdleHandler()",300000) 'Ignore any other key in alertview mode window.event.returnValue = false End If End If End Sub '---------------------------------------------------------------------------- ' Function: GotoAlertView ' Description: Goes to alertview mode if a alert is selected ' Input Variables: None ' Output Variables: None ' Return Values: None ' Global Variables: None '---------------------------------------------------------------------------- Sub GotoAlertView(intIndex) bAlertViewMode = true window.event.returnValue = false 'hide everything SaAlert1.style.display = "none" SaAlert2.style.display = "none" SaAlert3.style.display = "none" SaDesc1.style.display = "none" SaDesc2.style.display = "none" SaIpHostInfo.style.display = "none" SaPageInfo.style.display = "none" SaTasksLink.style.display = "none" ResourceCtrl.style.display = "none" 'display the long alert description If bOnlyOnePage = false Then SaAlertView.innerText = AlertsArray(intCurrentAlert,2) Else SaAlertView.innerText = AlertsArray(intIndex,2) End If SaAlertView.style.display = "" 'start the timer iIdleTimeOut = window.SetTimeOut("IdleHandler()",300000) End Sub Sub IdleHandler() 'go back to normal mode SaAlert1.style.display = "" SaAlert2.style.display = "" SaAlert3.style.display = "" SaDesc1.style.display = "" SaDesc2.style.display = "" SaIpHostInfo.style.display = "" SaPageInfo.style.display = "" SaTasksLink.style.display = "" ResourceCtrl.style.display = "" SaAlertView.style.display = "none" bAlertViewMode = false 'set the focus back to the selected alert If iFocusAlert = 0 Then SaAlert1.focus ElseIf iFocusAlert = 1 Then SaAlert2.focus ElseIf iFocusAlert = 2 Then SaAlert3.focus End If End Sub --> </SCRIPT> </HEAD> <BODY RIGHTMARGIN=0 LEFTMARGIN=0 onkeydown="KeyDown"> <IMG ID="SaLogo" STYLE="position:absolute; top:0; left=0; display:none" SRC="localui_salogo.bmp" BORDER=0> <A STYLE="position:absolute; top:0; left:0; font-size:10; font-family=arial; display:none" ID="SaAlertView" HIDEFOCUS=true onkeydown="KeyDown"> </A> <A STYLE="position:absolute; top:0; left:0; font-size:10; font-family=arial;" ID="SaAlert1" OnFocus="InvertSelection(0)" HIDEFOCUS=true onkeydown="KeyDown" OnClick="GotoAlertView(0)" OnBlur="InvertToNormal(0)"> </A> <A STYLE="position:absolute; top:12; left:0; font-size:10; font-family=arial;" ID="SaAlert2" OnFocus="InvertSelection(1)" HIDEFOCUS=true onkeydown="KeyDown" OnClick="GotoAlertView(1)" OnBlur="InvertToNormal(1)"> </A> <A STYLE="position:absolute; top:24; left:0; font-size:10; font-family=arial;" ID="SaAlert3" OnFocus="InvertSelection(2)" HIDEFOCUS=true onkeydown="KeyDown" OnClick="GotoAlertView(2)" OnBlur="InvertToNormal(2)"> </A> <A STYLE="position:absolute; top:12; left:5; font-size:10; font-family=arial;" ID="SaDesc1"> </A> <A STYLE="position:absolute; top:24; left:5; font-size:10; font-family=arial;" ID="SaDesc2"> </A> <A ID="SaIpHostInfo" STYLE="position:absolute; top:36; left:0; font-size:11; font-family=arial;"> </A> <A ID="SaPageInfo" STYLE="position:absolute; top:36; right:0; font-size:11; font-family=arial;"> </A> <A ID="SaTasksLink" href="localui_tasks.htm" onkeydown="KeyDown" OnFocus="InvertSelection(-1)" OnBlur="InvertToNormal(-1)"> <IMG ID="SaTasksImage" STYLE="position:absolute; top:48; right=0" SRC="localui_satask.bmp" BORDER=0> </A> <OBJECT TABINDEX=-1 STYLE="position:absolute; top:48; left=0; height:16;" ID="ResourceCtrl" CLASSID="CLSID:2FE9659A-53CB-4B06-9416-0276113F3106"> </OBJECT> <OBJECT TABINDEX=-1 STYLE="position:absolute; top:0; left=0; height:12; width:128" ID="TextResourceCtrl" CLASSID="CLSID:B00A25FB-D262-4f1d-A525-50EC006F666B"> </OBJECT> </BODY> </HTML>